const express = require("express");
const { expressjwt } = require("express-jwt");
const bodyParser = require("body-parser");
let app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());


//校验token
// app.use(expressjwt({secret:"mytoken",algorithms:['HS256']}).unless({path:[/\.png$/,'/checkuser'] }))

app.use(express.static("static")); // 加载静态文件


// 引入用户路由 
let userRouter = require("./routers/userRouter");
app.use("/user", userRouter);  // express里的二级路由

// 引入 登录的路由
let loginRouter = require("./routers/loginRouter");
app.use(loginRouter);

let advRouter = require("./routers/advRouter");
app.use("/adv", advRouter);

app.listen(8989, () => {
  console.log("server run at 8989");
});
